package com.great.common.dao;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

public class MusicDao {
	
	/**
	 * 获取音乐
	 * @return
	 */
	public List<Record> getListMusic(){
		return Db.find("select * from MusicList");
	}
	
	/**
	 * 获取上次播放的音乐
	 * @return
	 */
	public Record topMusic(){
		return Db.findFirst("select * from MusicList where status = 1");
	}
	
	/**
	 * 根据ID获取下一首音乐
	 * @return
	 */
	public Record nextByIdMusic(String id){
		return Db.findFirst("select * from MusicList where status = 1");
	}
	
	public int putMusic(String name,String palytime,String palycount,String path,String createtime,String status){
		return Db.update("insert into `MusicList` (`name`, `palytime`, `palycount`, `path`, `createtime`, `status`) values(?,?,?,?,?,?)");
	}
}
